home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-09-28 | 5.4 KB | 203 lines | [TEXT/MPS ] |
- %
- % File: GlyphShapeProcs.ps
- %
- % Contains: Procedures needed to render glyph shapes
- %
- % Version: Technology: Quickdraw GX 1.1.x.
- %
- % Copyright: © 1991-7 by Apple Computer, Inc., all rights reserved.
- %
- %
-
- %
- % Define a kshow for type-0 fonts on printers that are type-0 aware. type-0 aware
- % is determined by the cshow operator being present.
- % If only Adobe had bothered to ensure that all text operators (including kshow) worked properly
- % with composite fonts, then this wouldn't be necessary. The fact that I'm able to define
- % my own proves that there was no excuse for Adobe to have left this out.
- %
- /GXkshow /kshow load def % Start kshow out to be the real kshow.
- /cshow where {pop} {save} ifelse % Redefine GXkshow if cshow is known (implying composite font capable)
-
- /type0String null def
- /type0Char 1 string def
- /type0firstChar true def
- /GXkshow {
-
- currentfont /FontType get 0 ne {
-
- kshow
-
- } {
-
- /type0String Xstore
- /kshowProc Xstore
- /type0firstChar true store
-
- % Procedure passed to cshow will call the kshow procedure (except first time) and then draw the glyph
-
- {
- pop pop % We don't care about the advance vector.
- type0Char exch 0 exch put % Save the character in a 1 byte string.
- type0firstChar { % If it's the first character, do nothing but toggle flag.
- /type0firstChar false store
- } { % else execute the kshow procedure before drawing glyph.
- -1 -1 kshowProc % Call kshow proc, but push bogus character codes on stack
- } ifelse
-
- type0Char show % Show the character
-
- } type0String cshow
-
- } ifelse
-
- } bind def
-
- /cshow where {pop} {restore} ifelse % Restore away definitions if cshow wasn't known.
-
-
- %<FF>
- %
- % Procedure KshowAbsPos:
- %
- % Procedure is passed to kshow to render a glyph group that
- % specifies absolute positions for each glyph.
- % The current point is expected to be in the position of the first glyph.
- %
- % Stack should be before the kshow operation:
- % xN yN xN-1 yN-1…… x2 y2
- %
- /KshowAbsPos {
-
- pop pop % We don't care about the kerning pair.
- moveto % move to the next point on the stack.
-
- } Bdef
-
-
-
- %
- % Procedure KshowAbsPosH:
- %
- % Procedure is passed to kshow to render a glyph group that
- % specifies absolute positions for each glyph but all share the same Y.
- % The current point is expected to be in the position of the first glyph.
- %
- % Stack should be before the kshow operation:
- % xN xN-1…… x2 Y
- %
- /KshowAbsPosH {
-
- pop pop % We don't care about the kerning pair.
- dup % Make a duplicate of the Y value.
- 3 1 roll % Move it behind the next X value.
- moveto % Move to the position.
-
- } Bdef
-
-
- %
- % Procedure KshowAbsPosV:
- %
- % Procedure is passed to kshow to render a glyph group that
- % specifies absolute positions for each glyph but all share the same X.
- % The current point is expected to be in the position of the first glyph.
- %
- % Stack should be before the kshow operation:
- % yN yN-1…… y2 X
- %
- /KshowAbsPosV {
-
- pop pop % We don't care about the kerning pair.
- dup % Make a duplicate of the X value.
- 3 1 roll % Move it behind the next Y value.
- exch % Top of stack was Y X
- moveto % Move to the position.
-
- } Bdef
-
-
- %
- % Procedure KshowDelta:
- %
- % Procedure is passed to kshow to render a glyph group that
- % specifies deltas for each glyph.
- % The current point is expected to be in the position of the first glyph.
- %
- % Stack should be before the kshow operation:
- % xN yN xN-1 yN-1…… x2 y2
- %
- /KshowDelta {
-
- pop pop % We don't care about the kerning pair.
- rmoveto % Add the delta.
-
- } Bdef
-
-
-
- %
- % Procedure KshowDeltaH:
- %
- % Procedure is passed to kshow to render a glyph group that
- % specifies absolute positions for each glyph but all share the same Y.
- % The current point is expected to be in the position of the first glyph.
- %
- % Stack should be before the kshow operation:
- % xN xN-1…… x2 Y
- %
- /KshowDeltaH {
-
- pop pop % We don't care about the kerning pair.
- dup % Make a duplicate of the Y value.
- 3 1 roll % Move it behind the next X value.
- rmoveto % Add the delta.
-
- } Bdef
-
-
- %
- % Procedure KshowDeltaV:
- %
- % Procedure is passed to kshow to render a glyph group that
- % specifies absolute positions for each glyph but all share the same X.
- % The current point is expected to be in the position of the first glyph.
- %
- % Stack should be before the kshow operation:
- % yN yN-1…… y2 X
- %
- /KshowDeltaV {
-
- pop pop % We don't care about the kerning pair.
- dup % Make a duplicate of the X value.
- 3 1 roll % Move it behind the next Y value.
- exch % Top of stack was Y X
- rmoveto % Add the delta.
-
- } Bdef
-
-
-
- %
- % Procedure CnstDltShw:
- %
- % Procedure used to display a run of glyphs That had
- % advance bits of all zero but a constant delta value
- % Note, an rmoveto by the advance must be emitted by Imaging
- % Engine prior to doing this operation for proper results.
- % It is assumed that the current point is where the first
- % character is to draw.
- %
- % Ax Ay string CnstDltShw -
- %
- /CnstDltShw {
-
- 3 1 roll % Make stack: string Ax Ay
- 2 copy % Save a copy of Ax Ay for later so we can fix the current position.
- 5 -1 roll % Make Stack: Ax Ay Ax Ay string
- ashow % Do the ashow, stack is left Ax Ay
- neg exch neg exch % Stack is now: -Ax -Ay
- rmoveto % Undo the addition of Ax Ay to the advance of the last glyph in the run.
-
- } Bdef
-